<?php
/**
 * @author Eugenio Fage
 * http://eugeniofage.wordpress.com/
 * http://code.google.com/p/monky/
 * 
 */
class Log extends AppModel {
	var $name = 'Log';
	
	function getWrongLogins($ip,$minutesInterval=60){
		return $this->find('count',array(
			'recursive'=>-1,
			'conditions'=>array(
				'Log.extradata'=>$ip,
				'Log.type'=>'login_failed',
				'Log.created > date_sub(now(), interval '.$minutesInterval.' minute)'
			)
		));
	}
	
	
}
